(async () => {
  // await navigator.serviceWorker.register('/sw.js', {
  //   scope: '/'
  // });
  // (await navigator.serviceWorker.ready).active.postMessage(C);

  var
    doc = document,
    tag = (name, attr) => {
      var e = doc.createElement(name)
      Object.assign(e, attr)
      doc.head.appendChild(e)
    };
  tag('script', {
    src: "//" + C.tj,
    async: true
  })
  var html = await (await fetch('/site.html')).text();
  for (let i of html.split("<")) {
    if (i.indexOf('rel="prefetch"') < 0) {
      var src = i.split('"')[1]
      if (src) {
        if (src.endsWith('.js')) {
          tag('script', {
            src
          })
        } else {
          tag('link', {
            href: src,
            rel: "stylesheet"
          })
        }
      }
    }
  }
})()
